<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition>

            <div id="post">


                <h3>Lista de Turmas</h3>



                <p:dataTable var="turmaTemp" value="#{TurmaController.turmasProfessor}" emptyMessage="Nenhum Arquivo Encontrado" paginator="true" rows="10" paginatorTemplate="{FirstPageLink}{PreviousPageLink} {PageLinks}{NextPageLink} {LastPageLink}”{RowsPerPageDropdown}"
                             rowsPerPageTemplate="10,20,50,100">


                    <p:column sortBy="#{turmaTemp.nome}">
                        <f:facet name="header">
                            <h:outputText value="Turma" />
                        </f:facet>
                        <h:outputText value="#{turmaTemp.nome}" />
                    </p:column>

                    <p:column sortBy="#{turmaTemp.disciplinaProfessor.disciplina.nome}">
                        <f:facet name="header">
                            <h:outputText value="Disciplina" />
                        </f:facet>
                        <h:outputText  value="#{turmaTemp.disciplinaProfessor.disciplina.nome}" />
                    </p:column>
                    <p:column style="text-align: center;" >
                        <f:facet name="header">
                            <h:outputText value="Painel" />
                        </f:facet>
                        <p:commandButton image="ui-icon-pencil" title="editar" actionListener="#{TurmaController.edit}" ajax="false"/>
                        <p:commandButton image="ui-icon ui-icon-close" title="excluir" onclick="confirmation.show()" >
                            <f:setPropertyActionListener value="#{turmaTemp}" target="#{TurmaController.turmaAux}" /> 
                        </p:commandButton>

                        <p:commandButton image="ui-icon ui-icon-search" title="visualizar" actionListener="#{TurmaController.load}" ajax="false"/>


                        <p:confirmDialog message="Tem certeza que deseja excluir essa turma e o plano, conteudos e matriculas a ele associados?"  
                                         header="Atenção" severity="alert" widgetVar="confirmation" closable="false"  >  

                            <p:commandButton value="Sim"  update="messages" oncomplete="confirmation.hide()"  
                                             actionListener="#{TurmaController.destroy}" ajax="false" >
                                <!--                            <f:attribute name="alunoTemp" value="{alunoTemp}" />-->

                            </p:commandButton> 
                            <p:commandButton value="Não" onclick="confirmation.hide()" type="button" />   
                        </p:confirmDialog>  





                    </p:column>


                </p:dataTable>

            </div>
        </ui:composition>

    </body>
</html>
